﻿<%@ Import Namespace="Ornament.MemberShip" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UserEditorViewCtl.ascx.cs"
    Inherits="Admin_MemberAdmin_Controls_UserEditorViewCtl" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="Microsoft.Practices.Web.UI.WebControls" Namespace="Microsoft.Practices.Web.UI.WebControls"
    TagPrefix="pp" %>
<%@ Register Src="~/Admin/Member/Controls/RoleAssign.ascx" TagName="RoleAssign" TagPrefix="cc2" %>
<%@ Register Src="~/Admin/Member/Controls/UserGroupAssign.ascx" TagName="UserGroupAssign"
    TagPrefix="cc3" %>
<pp:ObjectContainerDataSource ID="ObjectContainerDataSource1" runat="server" DataObjectTypeName="Ornament.MemberShip.User"
    OnSelecting="GetUser" OnCreating="OnCreatingFromPresenter" OnUpdated="onUpdateUser"
    OnDeleted="onDeleteUser" />

<script type="text/javascript" language="javascript">
    $(document).ready(function() {
        $("#first").tabs();
    });        
</script>

<div>
    <asp:Button ID="ButtonSave" runat="server" Text="保存" OnClick="Save" CssClass="iconButton accept" />
</div>
<div id="first">
    <ul>
        <li><a href="#editUser">用户信息</a></li>
        <li><a href="#changepassword">密码修改</a></li>
        <li><a href="#roleAssign">角色分配</a></li>
        <li><a href="#userGroupAssign">用户组分配</a></li>
        <li><a href="#anotherInfo">其他信息</a></li>
        <li><a href="#allRoleInformation">所有角色信息</a></li>
    </ul>
    <div id="editUser">
        <asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectContainerDataSource1"
            DefaultMode="Edit" DataKeyNames="LoginId" Width="100%">
            <EditItemTemplate>
                <div>
                    <p>
                        <asp:Label ID="NameLabel" runat="server" Text="显示名称:" AssociatedControlID="NameText"></asp:Label>
                        <asp:TextBox ID="NameText" runat="server" Text='<%# Bind("Name") %>' />
                    </p>
                    <p>
                        <asp:Label ID="EmailLabel" runat="server" Text="Email:" AssociatedControlID="EmailText"></asp:Label>
                        <asp:TextBox ID="EmailText" runat="server" Text='<%# Bind("Email") %>' />
                    </p>
                    <p>
                        <asp:Label ID="PhoneLabel" runat="server" Text="电话:" CssClass="label"></asp:Label>
                        <asp:TextBox ID="PhoneText" runat="server" Text='<%# Bind("Phone") %>' />
                    </p>
                    <p>
                        <asp:Label ID="CommentLabel" runat="server" Text="备注:" CssClass="label"></asp:Label>
                        <asp:TextBox ID="CommentText" runat="server" Text='<%# Bind("Comment") %>' />
                    </p>
                    <asp:CheckBox ID="IsApprovedCheckBox" runat="server" Checked='<%# Bind("IsApproved") %>'
                        Text="通过审核" TextAlign="Left" />
                    <asp:CheckBox ID="IsLockoutCheckBox" runat="server" Checked='<%# Bind("IsLockout") %>'
                        Text="禁用" TextAlign="Left" />
                </div>
            </EditItemTemplate>
        </asp:FormView>
    </div>
    <div id="changepassword">
        <asp:UpdatePanel ID="updatePanel1" runat="server">
            <ContentTemplate>
                <asp:Button ID="SendPasswordByEmail" runat="server" CssClass="iconButton mailSend"
                    OnClick="SendPassword" Text="通过邮件发送密码" CausesValidation="false"></asp:Button>
                <asp:Button ID="ResetPasswordButton" runat="server" CssClass="iconButton" Text="生成密码"
                    CausesValidation="false" OnClick="ResetPassword" />
                <div>
                    <asp:ChangePassword ID="ChangePassword1" runat="server" ChangePasswordButtonType="Link"
                        CancelButtonType="Link" OnContinueButtonClick="ChangePassword1_ContinueButtonClick">
                    </asp:ChangePassword>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <div id="roleAssign" style="height: 280px">
        <cc2:RoleAssign ID="RoleAssign1" runat="server" />
    </div>
    <div id="userGroupAssign">
        <cc3:UserGroupAssign ID="UserGroupAssignView1" runat="server" />
    </div>
    <div id="allRoleInformation">
        <asp:GridView ID="GridViewRole" runat="server" CssClass="dataGrid">
        </asp:GridView>
    </div>
    <div id="anotherInfo">
        <asp:FormView ID="FormView2" runat="server" DataSourceID="ObjectContainerDataSource1"
            DefaultMode="ReadOnly" DataKeyNames="LoginId" Width="100%">
            <ItemTemplate>
                <p>
                    <asp:Label ID="Label5" runat="server" Text="最近修改时间:" AssociatedControlID="UpdateTimeLabel"></asp:Label>
                    <asp:Label ID="UpdateTimeLabel" runat="server" Text='<%# Eval("UpdateTime") %>' />
                </p>
                <p>
                    <asp:Label ID="Label6" runat="server" Text=" 注册时间:" AssociatedControlID="CreateTimeLabel"></asp:Label>
                    <asp:Label ID="CreateTimeLabel" runat="server" Text='<%# ((UserInformation)Eval("Information")).CreateTime %>' />
                </p>
                <p>
                    <asp:Label ID="Label7" runat="server" Text="最近密码修改时间:" AssociatedControlID="LastPasswordChangedDateLabel"></asp:Label>
                    <asp:Label ID="LastPasswordChangedDateLabel" runat="server" Text='<%# ((UserInformation)Eval("Information")).LastPasswordChangedDate %>' />
                </p>
                <p>
                    <asp:Label ID="Label8" runat="server" Text=" 最近锁定时间:" AssociatedControlID="LastLockoutDateLabel"></asp:Label>
                    <asp:Label ID="LastLockoutDateLabel" runat="server" Text='<%# ((UserInformation)Eval("Information")).LastLockoutDate%>' />
                </p>
                <p>
                    <asp:Label ID="Label9" runat="server" Text="最近登陆时间:" AssociatedControlID="LastLoginDateLabel"></asp:Label>
                    <asp:Label ID="LastLoginDateLabel" runat="server" Text='<%# ((UserInformation)Eval("Information")).LastLoginDate %>' />
                </p>
                <p>
                    <asp:Label ID="Label10" runat="server" Text="最近活动时间:" AssociatedControlID="LastActivityDateLabel"></asp:Label>
                    <asp:Label ID="LastActivityDateLabel" runat="server" Text='<%# ((UserInformation)Eval("Information")).LastActivityDate %>' />
                </p>
            </ItemTemplate>
        </asp:FormView>
    </div>
</div>
